import React, { ReactNode } from "react";
import { AuthProvider } from "./auth-context";
import { store } from "../store";
import { Provider } from "react-redux";
import { QueryClient, QueryClientProvider } from "react-query";

export const AppProviders = ({ children }: { children: ReactNode }) => {
  const queryClient = new QueryClient({
    defaultOptions: {
      queries: {
        refetchOnWindowFocus: false,
        // 窗口切换会发送请求，可以保持数据的准确性，   这里是把他关掉
      },
    },
  });
  return (
    <QueryClientProvider client={queryClient}>
      <Provider store={store}>
        <AuthProvider>{children}</AuthProvider>
      </Provider>
    </QueryClientProvider>
  );
};
// {/*<QueryClientProvider client={queryClient}>*/}
// <AuthProvider>{children}</AuthProvider>
// {/*</QueryClientProvider>*/}
